package org.liuyunfeng.web;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description:
 * @author: TanJingyu
 * @create: 2022-04-11 10:23
 **/
@RestController
@RequestMapping("/redirect")
public class RedirectController {

    @GetMapping
    public void redirect(HttpServletResponse response, HttpServletRequest request) throws IOException {
        request.setAttribute("username", "谭景玉");
        response.sendRedirect("/redirect/two");
    }

    @GetMapping("/two")
    public void two(HttpServletRequest request) {
        System.out.println(request);
    }
}

    